.TH "UNICORN" "3" "Jan 27th 2025" "Unicorn 1.0.4"
.SH NAME
uniattr \- text attributes
.SH LIBRARY
Embeddable Unicode Algorithms (libunicorn, -lunicorn)
.SH SYNOPSIS
.nf
.B #include <unicorn.h>
.PP
.BI "typedef uint32_t uniattr;"
.fi
.SH DESCRIPTION
This type represents a bit mask of text attributes.
Unless documented otherwise, all functions that accept a \f[B]uniattr\f[R](3) must observe the following rules:
.PP
There must be exactly one of the following character encoding flags present.
.PP
.RS
.IP \[bu] 2
\f[B]UNI_SCALAR\f[R](3)
.IP \[bu] 2
\f[B]UNI_UTF8\f[R](3)
.IP \[bu] 2
\f[B]UNI_UTF16\f[R](3)
.IP \[bu] 2
\f[B]UNI_UTF32\f[R](3)
.RE
.PP
There can optionally be one of the following endian flags.
If none are present, then \f[B]UNI_NATIVE\f[R](3) is assumed.
These flags are incompatible with \f[B]UNI_SCALAR\f[R](3) which is always in native byte order.
These flags have no effect with \f[B]UNI_UTF8\f[R](3) because UTF-8 is endian independent.
.PP
.RS
.IP \[bu] 2
\f[B]UNI_NATIVE\f[R](3)
.IP \[bu] 2
\f[B]UNI_LITTLE\f[R](3)
.IP \[bu] 2
\f[B]UNI_BIG\f[R](3)
.RE
.PP
There can optionally be any combination of the following flags.
.PP
.RS
.IP \[bu] 2
\f[B]UNI_TRUST\f[R](3)
.IP \[bu] 2
\f[B]UNI_NULIFY\f[R](3)
.RE
.PP
The following example demonstrates using these flags with \f[B]uni_next\f[R](3) to parse the first code point of a UTF-16 big endian string.
.PP
.in +4n
.EX
const char16_t text[] = u"Hello, World!";
int index = 0;
unichar cp;
uni_next(text, -1, UNI_UTF16 | UNI_BIG, &index, &cp);
.EE
.in
.SH SEE ALSO
.BR UNI_SCALAR (3),
.BR UNI_UTF8 (3),
.BR UNI_UTF16 (3),
.BR UNI_UTF32 (3),
.BR UNI_NATIVE (3),
.BR UNI_LITTLE (3),
.BR UNI_BIG (3),
.BR UNI_TRUST (3),
.BR UNI_NULIFY (3),
.BR uni_next (3)
.SH AUTHOR
.UR https://railgunlabs.com
Railgun Labs
.UE .
.SH INTERNET RESOURCES
The online documentation is published on the
.UR https://railgunlabs.com/unicorn
Railgun Labs website
.UE .
.SH LICENSING
Unicorn is distributed with its end-user license agreement (EULA).
Please review the agreement for information on terms & conditions for accessing or otherwise using Unicorn and for a DISCLAIMER OF ALL WARRANTIES.
